package com.example.mybatisplusdemo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.mybatisplusdemo.model.domain.Review;
import com.example.mybatisplusdemo.model.dto.PageDTO;
import com.example.mybatisplusdemo.model.dto.ReviewDTO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lxp
 * @since 2025-07-04
 */
public interface ReviewMapper extends BaseMapper<Review> {

    Page<ReviewDTO> listReviewsByUserId(Page<ReviewDTO> page, @Param("userId") Long userId);

    List<Review> selectParentReviewsByStoreId(@Param("storeId") Long storeId);

    void deleteChildReviewsByParentId(@Param("parentId") Long parentId);

    List<Long> listChildIdByParentId(@Param("parentId") Long parentId);

    List<Review> selectChildReviewsByParentId(@Param("parentId") Long parentId);

    List<Review> selectParentReviewsByUserId(@Param("userId") Long userId);
}
